package com.dycong.common.IO.socket;

import lombok.experimental.Delegate;
import org.springframework.stereotype.Service;

import javax.annotation.PreDestroy;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by dycong on 2017/3/23.
 */
@Service
public class ThreadPoolFactory {

    private static final int POLL_SIZE = 10;

    @Delegate
    ExecutorService executorService = Executors.newFixedThreadPool(POLL_SIZE);

    @PreDestroy
    private void destroy(){
        executorService.shutdown();
    }

}
